home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / What's New? / Sample Code / Graphics 2D / QuickDraw FX / FX.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  3.5 KB  |  136 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        FX.h
  3.  
  4.     Contains:    
  5.  
  6.     Written by: EL    
  7.  
  8.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 08/2000        JM                Carbonized, non-Carbon code is commented out
  20.                                             for demonstration purposes.
  21.                 7/13/1999    KG                Updated for Metrowerks Codewarror Pro 2.1
  22.                 
  23.  
  24. */
  25. #include "CarbonPrefix.h"
  26. #include <Types.h>
  27. #include <Windows.h>
  28.  
  29. #define        numTItems        8
  30. #define        numAItems        8
  31. #define        numCItems        4
  32. #define        numMItems        3
  33. #define        numDItems        2
  34. #define        numBItems        3
  35. #define        numPItems        2
  36. #define        numLItems        2
  37.  
  38. enum {
  39.     transferID = 1,
  40.     arithmeticID,
  41.     ditherID,
  42.     colorizationID,
  43.     searchProcID,
  44.     paintBucketID,
  45.     lassoID,
  46.     pixelAverageID,
  47.     customID
  48. };
  49.  
  50. typedef    struct {
  51.     Str255    label;
  52.     Rect    rect;
  53. } itemType;
  54.  
  55. typedef struct {
  56.     int        tItem;
  57.     int        aItem;
  58.     int        cItem;
  59.     int        mItem;
  60.     int        dItem;
  61.     int        bItem;
  62.     int        pItem;
  63.     int        lItem;
  64. } itemSettings;
  65.  
  66. extern    WindowPtr        gWindow;
  67. extern    GWorldPtr        gGWorld;
  68. extern    int                gCurrentExample;
  69. extern    itemSettings    settings;
  70.  
  71. extern    itemType    tItem[numTItems];
  72. extern    itemType    aItem[numAItems];
  73. extern    itemType    cItem[numCItems];
  74. extern    itemType    dItem[numDItems];
  75. extern    itemType    mItem[numMItems];
  76. extern    itemType    bItem[numBItems];
  77. extern    itemType    pItem[numPItems];
  78. extern    itemType    lItem[numLItems];
  79.  
  80. void initMac();
  81. void resetItems();
  82. void createWindow();
  83. void createOffscreen(int pictItem);
  84. void defineItems();
  85. void updateWindow();
  86. void drawBackground();
  87. void drawAllItems();
  88. void drawSourceImage();
  89. long drawFXImage();
  90.  
  91. void drawTransferItems();
  92. void drawArithmeticItems();
  93. void drawColorizeItems();
  94. void drawDitherItems();
  95. void drawMappingItems();
  96. void drawDestinationItems();
  97. void drawPaintBucketItems();
  98. void drawLassoToolItems();
  99.  
  100. void drawExampleName();
  101. void drawTime(long ticks);
  102.  
  103. void drawName(int left, int top, Str255 name );
  104. void drawItem(int left, int top, Str255 *label, Boolean listEnabled, Boolean itemEnabled );
  105.  
  106. void drawDeepBox(Rect *rect);
  107. void eraseRect(Rect *rect);
  108.  
  109. void eventLoop();
  110.  
  111. void setMenuItem( MenuHandle menu, int itemNum, Boolean enabled );
  112. void adjustMenus();
  113. //void setMenuItem();
  114. void handleMenu(long mSelect);
  115.  
  116. void doAboutBox();
  117. void drawMyString( int col, int *row, int increment, Str255 string);
  118. void setUpMenus();
  119.  
  120. void transferExample(Rect *rect, int item);
  121. void arithmeticExample(Rect *rect, int item);
  122. void colorizationExample(Rect    * rect, int item);
  123. void ditherExample(Rect    * rect,int item);
  124. void mappingExample(Rect * rect, int    item);
  125. void paintBucketExample(Rect *rect, int exampleItem, Point point);
  126. void lassoToolExample(Rect    * rect, int    exampleItem,Rect *frame);
  127. void pixelAverageExample(Rect    *rect, int     item);
  128. void customExample(Rect    * rect,int    item);
  129.  
  130. GrafPtr    CreateGrafPort(Rect *bounds);
  131. void    DisposeGrafPort(GrafPtr doomedPort);
  132. int setTransferMode(int     item );
  133. int setArithmeticMode(int item);
  134. int setDitherMode(int item);
  135. pascal Boolean matchProc(RGBColor *color, long        *position );
  136. pascal Boolean searchProc(RGBColor    * color, long        *position);